# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Duncan Bellamy <dunk@denkimushi.com>
pkgname=abseil-cpp
pkgver=20220623.0
pkgrel=1
pkgdesc="Abseil Common Libraries (C++) "
url="https://abseil.io/"
arch="all"
license="Apache-2.0"
makedepends="
	cmake
	gtest-dev
	linux-headers
	samurai
	"
subpackages="$pkgname-dev"
source="https://github.com/abseil/abseil-cpp/archive/$pkgver/abseil-cpp-$pkgver.tar.gz
	0002-abseil.patch
	"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_CXX_STANDARD=17 \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=ON \
		-DABSL_BUILD_TESTING=ON \
		-DABSL_USE_EXTERNAL_GOOGLETEST=ON \
		-DABSL_PROPAGATE_CXX_STD=ON \
		-DABSL_FIND_GOOGLETEST=ON
	cmake --build build
}

# disable broken tests
check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest --test-dir build -E "absl_str_format_convert_test|absl_mutex_test\
|absl_notification_test|absl_per_thread_sem_test|absl_sysinfo_test|absl_random_beta_distribution_test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
6a84254927cac285c77f6b2e77de23ce4f65c28acc0289228f3db552e247fb1dedf2c6e51a98da7df700c062612e27e6acd029122e8abc3fff12f3f5502c8c10  abseil-cpp-20220623.0.tar.gz
815d9a1e2e97808c3efd662c810a54641a51391c6726c5bb9f0b70190819c384cae58e7d94e2e9d2f7f23dc87e665de684f5c167c6f785d3df5529af817d2e8b  0002-abseil.patch
"
